Repository navigation
[DO NOT MERGE] AgentCore samples: run activities in workflow activity sessions - #422
Draft
justinschoeff wants to merge 3 commits into
Draft
justinschoeff wants to merge 3 commits into
justinschoeff wants to merge 3 commits into
Conversation
Activity sessions are not yet in a released temporalio, nor is session_options in the released AI plugins. agentcore deploy (CodeZip) installs dependencies locally for Linux arm64 with uv, so the samples need a Linux aarch64 temporalio wheel (plus an optional macOS one for local runs) and both plugin wheels. The script clones sdk-python and ai-integrations into .wheel-build/ at a configurable repo URL and ref (branch, tag or SHA), reusing the clone on re-runs; SDK_PYTHON_DIR / AI_INTEGRATIONS_DIR override with local checkouts and SDK_CORE_REPO overrides the sdk-core submodule URL. - temporalio is built as 1.34.0+sessions so it cannot be confused with the PyPI release; the Linux wheel is built in a manylinux2014 aarch64 container, the macOS wheel is skipped when no cargo is available. - Plugin wheels are built with --no-sources, ignoring ai-integrations' machine-local temporalio path source. - wheels/BUILD_INFO records the resolved commits and wheel hashes. - RELOCK=1 re-locks the samples after building. Temporary; delete once the releases exist.
The plugin now fills ActivitySessionOptions(UseWorkflowSession()) so model calls and execute_code run on the AgentCore microVM holding the workflow. The worker admits a single session keyed on the AgentCore session id, falling back to no admission without one. Path sources pin temporalio (1.34.0+sessions) and temporalio-strands-agents to ../wheels so neither can come from PyPI, including in the uv pip install that agentcore deploy runs, and create-runtime.sh checks the wheels exist. Also cap strands-agents-tools below 0.9, which removed code_interpreter: the deploy installs from pyproject.toml, not uv.lock, so it picked 0.9. Document the session placement, the server requirement and building the wheels with ../build-local-wheels.sh in the README.
Mirror the Strands AgentCore sample with the OpenAI Agents SDK: OpenAIAgentsPlugin with session_options, a SingleSessionAdmission Worker keyed on the AgentCore session, and an execute_code Activity on the bedrock_agentcore CodeInterpreter client. Dependencies resolve from the wheels built by ../build-local-wheels.sh. Include the AgentCore deploy config (runtime temporal_openai_worker, CodeZip, OPENAI_API_KEY placeholder), the Code Interpreter policy, the invoke-role template and scripts (create-runtime.sh checks for the openai plugin wheel), and a README.
justinschoeff
force-pushed
the
feature/activity-sessions
branch
from
November 16, 2026 17:56
42fc96e to
f3250be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
Do not merge. Depends on the unreleased sdk-python
dev/sticky-activitiesactivity-session API (ate73f54d3) and on the unreleasedsession_optionsplugin argument (temporalio/ai-integrations#584). The samples resolvetemporalioand the plugins from locally built wheels in the gitignoredbedrock_agentcore/wheels/directory via[tool.uv.sources]path sources, so CI cannot install them. Before merge, once the releases exist: deletebuild-local-wheels.shand the path sources, pin the released versions, and re-lock.What
Runs the AgentCore samples' activities (model calls,
execute_code) inside the workflow's activity session. They execute on the same AgentCore microVM that holds the workflow.bedrock_agentcore/build-local-wheels.sh(temporary):agentcore deploy(CodeZip) installs dependencies for Linux arm64, so this script builds the following intobedrock_agentcore/wheels/:temporaliowheel (in docker) and a macOStemporaliowheel, both labelled1.34.0+sessionstemporalio-strands-agentsandtemporalio-openai-agentswheelsstrands_agent/):StrandsPlugin(session_options=ActivitySessionOptions(placement=UseWorkflowSession())).WorkerSessionConfig(admission=SingleSessionAdmission(stable_identity=<AgentCore session id>)), and falls back to no admission when there is no session id.strands-agents-toolsis capped at<0.9, because 0.9.0 removedcode_interpreterand the deploy installs frompyproject.tomlrather thanuv.lock.openai_agent/):OpenAIAgentsPlugin(session_options=...)and the OpenAI API (OPENAI_API_KEY).execute_codeactivity uses thebedrock_agentcoreCodeInterpreter client.Commits
Add script to build unreleased AgentCore sample depsResolve Strands sample deps from local wheelsRun Strands sample activities in workflow sessionsAdd AgentCore OpenAI Agents sample with activity sessionsTesting
tests/test_activity_sessions.pyplus the existing tests) pass locally against the locally built wheels.system.enableStickyActivityExecution).